Saturday, March 31, 2007

revelling in my geekdom

I am forever updating the template for this blog: adding something here, removing something there, making big changes every so often, all in the name of making this page fun and easy on the eyes.

A few days ago I decided I wanted to add more games. I've had a sudoku game just above the cartoons at the bottom of the page for ages, and that was fine, but I wanted more. So, I searched around a bit and found Peeptin by Flooble. I put it at the bottom of the sidebar. You've probably played this game before, with a set of jumbled up tiles numbered 1 to 15 in a 4x4 grid, which you need to slide around to put back in order.

And that was fine, as far as that went. But, I wanted another game, something a little more challenging than Peeptin. So, I went looking for a javascript chess program that I could put in the sidebar. And, I found a fairly decent one, here.

This is where my geekiness comes in. I took the original program and shrunk down the images of the board and pieces so that the game would fit in the sidebar. Then I started playing it. Well, it isn't the strongest player, certainly not the strongest chess program that I've played against, but it was fairly adequate for a little diversion. But, I started noticing some annoying little bugs in the program.

When I was about 12 years old, my great-grandfather gave me some advice: "Learn lots of languages". I'm sure that he thought that he was advising me to learn lots of human languages, and I did study French in high school and German in university. But where I really followed his advice was in learning computer languages.

Over the last couple of dozen years I learned language after language (probably about 15 or 20 so far, I've lost count), and it became easier and easier to pick up more as I went along. After a while, computer languages all look very similar, and it merely becomes a matter of figuring out the quirks of syntax, the similarities and differences to other languages.

I've never programmed in javascript before, but I wanted to get rid of those bugs. So I started looking at the code, and my nightmare began. None of the code was documented, nor was it indented. The variable names and function names were non-descriptive names like "au" or "Z" or "ma". The programmers reading this out there probably shuddered when they read those last two sentences.

So, I went through the code and put in indents where I thought they should go, and started making a list of function names and variable names, with descriptions of what I thought each one did. Along the way, I was learning javascript by reading the code.

The bugs in the program were:
- allowed castling while in check
- castling on the queen side was intermittently disallowed even though the conditions for allowing castling were met
- it wouldn't let either king into square A8
- pawns would only promote to queens, no matter what was selected in the drop-down list
- if "CPU White" was selected, the human player still had to make the first move for the computer
- the border around the board looked strange when the board was shrunk down to a size that would fit in the sidebar

Then there were some things that weren't bugs per se, but still annoying. The original programmer hadn't included the rule that if a board arrangement repeated three times, then it is a stalemate. The player could only play one game; to start over or to play another game, one had to reload the entire webpage (which isn't really a good thing when one's page is as big as this one). Finally, the game log would only display the first 60 moves of the game.

So, I started playing with the code. I added the New Game button, and changed the game log so that it would display an unlimited number of moves in a scrolling panel. Then one by one I tackled the bugs, and with a lot of experimentation I managed to get them all worked out. I modified the pawn promotion algorithm a little so that the human player could choose what piece to be promoted to, but still forced the computer to promote its pawns to queens. Finally I added the code necessary to compare the current board arrangement with previous arrangements, counting the number of duplicate occurrences and declaring a stalemate if the board arrangement repeated three times.

I'm not done with this chess program yet. I have a number of ideas of ways to make it a better player. By the time I am done, there will be some radio buttons to select a skill level for the computer. After that, I will post the revised code, so that anyone who wants to have this corrected and improved javascript chess program on their website can just copy and paste the code.

Over the course of doing this I learned a lot about javascript programming, and I still want more sidebar games. I think one of these days I'm going to write a version of Tetris for the sidebar, and I might just rewrite the whole sudoku section as well.

Wednesday, March 28, 2007

State of the Armadillo

Armadillo Aerospace has posted this video on their website, which they presented at the Space Access '07 conference this past weekend. I uploaded it to YouTube for all to see.

Sunday, March 25, 2007

the Great Science Fiction Movie Poll

Update, April 23: We're into the final round of voting.

Update, April 1: Voting is now closed on this first round. Go here for the second round of voting.

Update: After I posted this, I realized that the format was unwieldy. It was a big hassle to vote in 16 separate polls to come up with favorite movies. Furthermore, there were some really tough choices to be made between some of the movies in several of the individual polls in this first round of voting. So, I have reworked the poll. Now, instead of picking one movie out of a group of 8, you just put a checkmark beside the titles of up to 25 of your favorite science fiction movies, and only have to hit the Submit button once. The new poll closes at 5pm MDT on Sunday, April 1st (2300 GMT). Sorry to those few people who took the time to vote in my unwieldy first attempt at this poll. The scores have all been reset, and you can all vote again.

I kept on thinking of great science fiction movies that I should have put in the list the other day, lots of them. And, Dan Schrimpsher asked me if I was on crack, for not putting Serenity at the top of the list (I'm not). Well, I figure that this is the sort of thing that calls for a poll. I searched through the Science Fiction category on the Internet Movie Database, and out of the thousands of titles there I selected 134 movies. Out of the list below, click on as many as 25 of your favorite science fiction movies.

The polling software allows only one vote per poll per IP address, so if you really really want a particular movie to make it to the next round, then tell your friends about this poll so that they can vote too. The more people who vote, the better the results will be.

Next week, I will make up a new set of polls, with only the top-scoring 16 or 32 movies (I haven't decided yet) from this poll. I'm leaning towards making this a playoff format starting next week. So, by the end of April or so, we should have the top science fiction movie, as voted by you, the Robot Guy readers.

Sci-Fi Movies, Round 1
Pick Up To 25 Favorites From The List
20000 Leagues Under the Sea
2001: A Space Odyssey
28 Days Later…
A Clockwork Orange
Alien
Alien 3
Alien Nation
Aliens
Altered States
Armageddon
Back to the Future
Back to the Future II
Back to the Future III
Barbarella
Battlefield Earth
Battlestar Galactica (miniseries)
Bicentennial Man
Blade Runner
Brazil
Bride of Frankenstein
Capricorn One
Children of Men
Close Encounters of the Third Kind
Coneheads
Cyborg
Dark Star
Deep Impact
Delicatessen
Demolition Man
Destination Moon
Donnie Darko
Earth Girls Are Easy
Enemy Mine
Escape from New York
ET the Extra-Terrestrial
Fail-Safe
Fantastic Four
Forbidden Planet
Frankenstein
Gattaca
Hackers
I, Robot
Independence Day
Innerspace
Invasion of the Body Snatchers
Johnny Mnemonic
Jurassic Park
King Kong
K-PAX
Logan's Run
Mad Max
Mad Max Beyond Thunderdome
Mars Attacks!
Men In Black
Men in Black II
Metropolis
Minority Report
Moonraker
My Stepmother Is An Alien
Night of the Living Dead
Nineteen Eighty Four
Outland
Planet of the Apes
Predator
Robocop
Rollerball
Scanners
Serenity
Short Circuit
Silent Running
Slaughterhouse-Five
Sleeper
Sneakers
Solyaris
Spaceballs
SpaceCamp
Species
Spiderman
Spiderman 2
Stalker
Star Trek the motion picture
Star Trek II - the Wrath of Khan
Star Trek III - the Search for Spock
Star Trek IV - the Voyage Home
Star Trek V - The Final Frontier
Star Trek VI - The Undiscovered Country
Star Trek: First Contact
Star Trek: Generations
Star Trek: Insurrection
Star Trek: Nemesis
Star Wars I - The Phantom Menace
Star Wars II - Attack of the Clones
Star Wars III - Revenge of the Sith
Star Wars IV - A New Hope
Star Wars V - The Empire Strikes Back
Star Wars VI - Return of the Jedi
Stargate
Starman
Starship Troopers
Superman
Terminator 2: Judgement Day
The Abyss
The Andromeda Strain
The Blob
The Boys from Brazil
The Day of the Triffids
The Day the Earth Stood Still
The Fifth Element
The Fly
The Hitchhiker's Guide to the Galaxy
The Holy Mountain
The Incredibles
The Invisible Man
The Iron Giant
The Last Starfighter
The Matrix
The Matrix Reloaded
The Matrix Revolutions
The Road Warrior
The Running Man
The Terminator
The Thing
The Truman Show
Total Recall
Treasure Planet
Tremors
Tron
Twelve Monkeys
V for Vendetta
War Games
War of the Worlds
X2
X-men
Young Frankenstein

Thursday, March 22, 2007

Favorite Science Fiction Movies

In honor of the 25th anniversary this year of Blade Runner, Sciencedude is taking suggestions for a list of the greatest science fiction films ever made. I emailed him my suggestions, and then had several "oh, yeah, that one!" moments afterwards. Here is my (revised) list of my top 25 favorite science fiction movies:

25. Enemy Mine. Lou Gossett Jr. makes a great lizard.
24. Outland. Sean Connery rocks as a space marshal, the only law on a mining facility on Jupiter's moon Io.
23. Innerspace. A fun take on Isaac Asimov's Fantastic Voyage, starring Dennis Quaid and a seemingly-possessed Martin Short.
22. Silent Running. Bruce Dern saves the last of the trees in a space ship.
21. Dark Star. Teaching phenomenology to a bomb.
20. Tron. Hacker is scanned into a virtual existence inside a computer, forced to fight the eeeevil Master Control Program. Very cool special effects, and still entertaining.
19. Planet of the Apes. "Get your stinking paws off me, you damn dirty ape!" The novel by Pierre Boulle was awesome, too.
18. Escape from New York. Kurt Russell as Snake Plissken rescuing the President from the hellhole maximum security prison that is New York circa 1998.
17. ET the extraterrestrial. Steven Spielberg's most successful movie, from back when Drew Barrymore was a cute, precocious kid.
16. Close Encounters of the Third Kind. Richard Dreyfuss making mountains out of mashed potatoes. That Steven Spielberg sort of has a flair for the skiffy movies, doesn't he?
15. Altered States. William Hurt blowing his mind.
14. The Last Starfighter. How can you not love the story of a video-game geek who saves the galaxy?
13. The Terminator. Michael Biehn as the good guy, Linda Hamilton making the transition from wimp to tough guy, and some musclebound dude with a funny name: "I'll be back".
12. The Abyss. It has plot holes that you can drive a Mac Truck through, but this time Michael Biehn is the bad guy, and he's awesome as the bad guy. James Cameron went all-out in this movie, and Ed Harris literally (yes, I know that word is often mis-used, but I do mean literally) drowns in a highly-oxygenated fluid. Ya gotta admire that kind of dedication to the craft. Amazing special effects, particularly the water/alien thingy.
11. Alien. Sigourney Weaver as one of the strongest female characters, ever.
10. Blade Runner. Just what does it mean to be human?
9. The Fifth Element. Stop me if you've heard this plot before: Bruce Willis is an everyman with a violent past forced by circumstances to save the world and the woman he loves.
8. Gattaca. Have you ever wanted anything so bad that you were willing to do anything - even die - to get it?
7. The Matrix. Is any of this real? "You take the blue pill - the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill - you stay in Wonderland and I show you how deep the rabbit-hole goes."
6. Forbidden Planet. Yes, it's 50 years old, but it's still awesome.
5. The Fly. The arm wrestling scene alone was worth the price of admission.
4. Serenity. I was lucky enough to go see this movie for free, in exchange for reviewing it on my blog. What a blast. "I aim to misbehave."
3. 2001: A Space Odyssey. After this film, the song Also Sprach Zarathustra will always be associated with space. If you're going to do a space movie, this is how to get it done right.
2. Star Wars. Yes, I know, it's an obscure art house film that nobody's ever heard of.
1. Destination Moon. The oldest film on the list, and still (in my not so humble opinion) the best science fiction film ever made. Made 19 years before the first actual manned lunar mission, it is amazing how much of the science and engineering that they got bang-on. Based on the Robert A. Heinlein novel Rocketship Galileo.

Other great sci-fi movies that didn't make my top 25, but which I nonetheless enjoyed: Bicentennial Man, Total Recall, the Blob, Logan's Run, Scanners, Rollerball, The Running Man, Invasion of the Body Snatchers, and Barbarella.

What would be on your list?

Update: D'oh! How could I forget the three movies represented in my nifty new title graphic? I, Robot (loosely based on the Asimov novel of the same name), Fritz Lang's Metropolis, and Frankenstein starring Boris Karloff. Of those three, only Frankenstein would make my top 25, right around spot number 18 or so, bumping Enemy Mine off the top 25 list. Sorry, Lou. I've also heard many good things about Metropolis, but since I haven't seen the movie I can't place it among my favorites. And I, Robot was fun but not one of my top favorites.

Another movie that I totally forgot about as I was making my list has to be Star Trek II: the Wrath of Khan. Seeing Chekov getting "bugged", Kirk yelling "KHAAAAANNNNN!", Spock dying, oh the awesomeness. It would have to slide in there around number 20, which would bump Outland off the list, if not for my sleight of hand which allows me to bump Innerspace off the list instead. Not that I have anything against Dennis Quaid, bumping two of his movies off my list of 25, it's just that I probably should have put Outland higher on the list in the first place. Sorry, Dennis.

Some more sci-fi movies that I enjoyed, but which didn't make the top 25: Independence Day, Men in Black, Spiderman, Back to the Future, the Day the Earth Stood Still, Twelve Monkeys, and Spaceballs. Geez, I watch too many movies.

The Internet Movie Database also has a list of favorite sci-fi movies, as voted on by members of that site.

Wednesday, March 21, 2007

the Goracle

Dean Barnett skewers Al Gore:
Has there ever been a man who so desperately hungered for greatness who was so thoroughly suffused with mediocrity? ... The Goracle will not brook any news that might conflict with this chosen role or any sign that disaster is less than imminent. For if there is no immediate and enormous crisis, who needs a Global Savior? And if he can’t be president, and he can’t save the world, what good is a Goracle?

Rest in Peace

Cathy Seipp died today. The blogosphere just lost a giant.

Tuesday, March 20, 2007

Same Time, Same Station

Here's the update from SpaceX's Elon Musk:
The abort that occurred a few minutes before T-0 was triggered by our ground control software. It commanded a switchover of range telemetry from landline to radio, which took place correctly, however, because of the hardware involved, this transition takes a few hundred milliseconds. Before it had time to complete, our system verification software examined state and aborted.

Our simulations done beforehand all passed, because the simulator did not account for a hardware driven delay in the transition. We considered putting the vehicle into a safe state yesterday and updating the ground control software to make the very minor fix needed, but the safer course of action was to stand down.

Yesterday afternoon and evening (Kwaj time), our launch team updated the software to address the timing issue and verified that there were no similar problems elsewhere. We ran the software through several simulated countdowns and then once again with the rocket and range in the loop.

All systems are now go for launch with T-0 at 4pm California time today (Tues).
You can bet that I'll be here, watching the video and liveblogging.

Updates:

3:40pm PDT. The SpaceX Updates page now says that the launch has been moved to 5:05 pm PDT. The webcast is supposed to start an hour before launch, so I'll check back in with an update in half an hour.

4:15 pm PDT, T-minus 50 minutes. The webcast has started. Fuel and liquid oxygen loading is about 40% complete.

T-minus 33 minutes. LOX loading is complete.

T-minus 15 minutes. Looks like everything is proceeding normally. The launch team is working its way through the countdown checklist. All stations are ready for launch.

T-minus 8 minutes. I've been having trouble getting a screenshot of the rocket, so I'm going to try something here. if this works, then the webcast will also be broadcast here on my blog. Whoops, that sucked. Anyone know why I can't get a frozen screen capture? When I try to do a capture, the live feed comes through rather than a screen cap. Weird.

Ah well. Anyhow, the strongback arm has been retracted. Keep your fingers crossed.

T-minus 2 minutes. The clock keeps ticking, there was a warning on their LOX pressure, but it looks like it isn't a concern.

T-minus 1 minute. My heart is pounding.

LIFTOFF! GO BABY GO! Whoa... wtf... abort?

Geez... they started the engines, and then immediately aborted. The rocket didn't even lift off the pad. At least they didn't blow it up or lose any hardware.

5:12 pm PDT. The vehicle has been put into a safe mode, and they are now determining what happened. No idea yet whether they will try again today.

5:17 pm PDT. It sounds like they are going to reset the clock to T-minus 11 minutes and try again.

5:35 pm PDT. They are looking to reset the clock to T-minus 16 minutes at 5:54 PDT, for a new launch time of 6:10 pm PDT (0110 Greenwich).

5:55 pm PDT, T-minus 15 minutes. The countdown has restarted.

T-minus 13 minutes. Everything is go, they are cleared for launch. Hopefully this third time's the charm...

T-minus ten minutes. Terminal count has started.

T-minus 4 minutes. I'm going to sit back and watch now, no more updates until after the launch.

T+3 minutes or so. The launch went off well, they had separation of first and second stages, and they definitely got into space. Then the webcast feed died. At the time the feed died, the engine bell was getting red hot. Hopefully they didn't have a burn-through.

7:18 pm PDT. Daniel Schmelzer reports that Elon Musk confirms that telemetry on the rocket was lost at T+5:05. The rocket did not make its intended orbit. Dang, double dang. However, the rocket did make it into space, successfully sepearated first and second stages, and the fairing did successfully separate. I'll post another update when I find out what happened to the rocket.

Upperdate: Via Space Liberates Us! comes this gif of the first stage separation. It looks like the first stage impacted the engine bell on the second stage.


Via Kimbal Musk (Elon's brother) comes this image of the second stage engine bell four minutes into the launch. Note the red-hot glow on the engine bell; I don't have access to SpaceX's test data, but I'm pretty sure that such a glow is not nominal, nor a good sign at all.


According to Elon, they did achieve 300 kilometers, which is well beyond the edge of space. It is not known at this time if the rocket achieved a very low eccentric orbit or if it crashed halfway around the world. I'll update as I find out. (Update to the update: it looks like it ended up crashing in the Pacific.)

I just downloaded the hi-res video of the launch, and I'm going to post it on YouTube. As soon as that upload is complete, I'll post the video of the launch here.

Uppestdate: Here's the video of the launch.

Monday, March 19, 2007

Private Orbital Rocket Launch Today

It looks like SpaceX is going to launch their Falcon 1 rocket today at 4pm Pacific time (11PM GMT). That is, assuming there are no last minute concerns, in which case the launch will be postponed. The launch will be webcast live starting an hour before the launch. Good luck to Elon Musk and the rest of the SpaceX team - I'll be watching with fingers crossed.

Updates:

T-minus 40 minutes?. The webcast is running. For some strange reason, the clock displayed at the lower right is stuck on T+00:00:29, even though the rocket is obviously in a T-minus configuration (i.e. on the ground). It looks like there is a light breeze there, as the trees around the pad are rustling a bit and clouds are passing by overhead. There is no sound right now. Hopefully that'll change.

T-minus 20 minutes?. SpaceX is still showing video of the rocket sitting on the pad with no sound. There have been no views from inside the control center, no voiceovers, nothing. If it wasn't for the clouds passing by overhead, I would think that my video player had frozen. There have been no further updates from either Elon Musk or Kimbal Musk all day, so I'm assuming that the launch is still going ahead.

T-minus 10 minutes?. Still no change in view, no sound, no indication whether the launch is actually going ahead, just clouds placidly passing by overhead. It looks like a beautiful morning on Kwajalein atoll, although breezy. Hopefully the wind isn't a problem for the launch.

T-minus whoknows. The rocket was scheduled for liftoff five minutes ago. Still no countdown, no audio, no information, no update on SpaceX's website, just a rocket sitting on a pad boiling off oxygen.

4:13 PDT. The rocket was scheduled to launch 13 minutes ago. Finally there's some sound!

4:20 PDT. Launch Director announces T-minus 25 minutes and counting.

T-minus 18 minutes. The countdown clock is finally operating, and it sounds like they are repressurizing the Helium in the top stage.

T-minus 15 minutes. Various flight control operators reporting Green across the board, countdown checklist proceeding. They are not planning on having any more holds, and it looks like they are ready for launch.

T-minus 10 minutes. It sounds like everything is proceeding normally, Terminal Count has started.

T-minus 8 minutes. The strongback has moved out of the way.

T-minus 4 minutes. Everything seems to be moving along smoothly.

T-minus 1:25. There is a terminal count abort, Looks like they are going to abort the launch.

Stuck at T-minus 1:02, 4:53 pm PDT. No word yet on what caused the abort, or whether they are going to reset the clock and try again.

4:54 pm PDT. They are going to take the next ten minutes figuring out why there was an abort, but from the sounds of it there was something in their flight path downrange that triggered the abort. (Probably some idiot in a boat.)

5:10 pm PST. The launch has been scrubbed for the day. Dang. I'll post the reason for the scrub as soon as Elon Musk updates the SpaceX website. They are now offloading the propellant and Helium from the rocket. It looks like the delay will be a day or two.

Sunday, March 18, 2007

The Battle of Thermopylae

The movie 300, which is breaking all sorts of box office records, has of course embellished the story of the defense of the pass of Thermopylae for dramatic effect. Here is a documentary which tells the whole story of the battle.

Update: the videos I originally posted here have been removed from YouTube. So, here are some other documentary videos that tell much the same story.

The Battle of Thermopylae, part 1



The Battle of Thermopylae, part 2



The Battle of Thermopylae, part 3



Ancient Warriors: the Spartans, part 1



Ancient Warriors: the Spartans, part 2



Ancient Warriors: the Spartans, part 3



Update: Nearly 2500 years of alluvial deposits have filled in much of the Gulf of Malis, and what was once a pass a mere 14 meters wide is now several kilometers of farmland. This is the pass of Thermopylae today, viewed from the East (click on the image for a larger version):

Saturday, March 17, 2007

SpaceX Falcon Engine Test

SpaceX just conducted a successful engine static fire test. The test went perfectly, and it looks like the Falcon could be launched as early as Monday. Here is some video of the test, taken from medium range:


And here is a closeup view of the engine test, taken with a high-speed camera:

Friday, March 16, 2007

Optical Illusion

I was reading Bad Astronomy a few minutes ago, and Phil Plait had a post there that tangentially touched on optical illusions. It reminded me of an optical illusion that I created a couple of weeks ago when I was learning how to program scenes in POV-Ray. Here it is. You can see that this picture has a lot of color in it. From about a foot away, stare at the center of the image for a few seconds. Do you see it turn into shades of gray?

illusion

I don't know what the name of this type of illusion is. If anyone knows, I'd appreciate it if they left a comment.

Update: Thanks to Barun Vurdlak for featuring this image as the illusion of the day at Mighty Optical Illusions blog. Apparently this illusion is related to the Hybrid Images illusion and the Color Adapting illusion.

Elastic Images

I've been working on a new blog template over the last few days.

Other than the Space Blogroll, I have removed most of the space-related things from the sidebar. They are all still available on the Space Feeds aggregator, so I figured they were redundant here. I have removed quite a few buttons from the sidebar, and added a couple buttons (Blogburst, AddThis, and the Darkgate Comic Slurper) as well. I have also removed some cartoons that haven't updated in a while.

Early on in my blogging days, I was messing around with the template and I accidentally erased the portion of the template that displays post titles. Ever since then I have made do by repeating the title of the post in boldface at the top of every post. I finally decided to fix that, giving a nice large blue title to each blog post. Of course, now that means I am going to have to go back through over 900 blog posts and eliminate the boldface-repeated-title from each one, as I have already done for the posts you see here on the main page. I figure that is probably going to be about five or six hours of work, yay.

But, these sorts of things are a trivial change here. I've done a number of such changes over the years.

The biggest change is probably not immediately apparent. Oh, sure, you've probably already noticed that I have changed the title section to an image. But there is something special about this image.

Resize your browser.

Pretty nifty, huh? The image stretches or contracts according to however wide you have set your browser. You will notice that the text in blog posts also stretches to fit, and if you look down the page and keep resizing, you'll see that the Sudoku puzzle area and the Station V3 comic also resize according to browser width.

I haven't checked it on all browsers, but it works in Opera 9.02, Firefox 2.0.0.2, and Internet Explorer 6. I have no idea if it works on other browsers, so if anyone reading this is on a Mac or using some other browser, please leave a comment telling me if this works for you.

The technique is called Elastic Design. I have long wanted to do this. Some people have much larger displays than others, and some are still using 800x600 displays. If someone has, say, a 1280x800 display, and the a website has a fixed width slightly smaller than 800 pixels (to allow for an 800x600 display with a vertical scrollbar on the right), then there is a lot of white space on the right hand side of the display for users with larger screens. However, if one wants to design the website so that it is viewable to almost all users without using horizontal scrolling, and one is stuck with a fixed-width website, then that whitespace must simply be accepted.

Elastic design allows us to get around this problem. With elastic design, it doesn't matter what size display the user has, or whether the user resizes their browser - the page simply adapts to fit the browser window.

Now, I did a lot of Googling over the last few days, trying to find out how to do this. Although the elastic text part was pretty easy, it was damn near impossible to find out how to do elastic images. I probably would have given up too - most sites that talked about this topic either had some very difficult code to implement, involving lots of javascript tricks and storage of multiple copies of the desired image, or else simply said that this was impossible - however, the Station V3 cartoon pretty much pushed me to keep trying.

The image for Station V3 is set at 750 pixels wide. My sidebar has a width of 160 pixels, with padding of five pixels on the left and ten more on the right, so if I wanted to show Station V3 at full size, my blog would need to be at least 925 pixels wide. My display is only 1024 pixels wide, so that would mean that I couldn't have my Favorites list up in IE6 without having a horizontal scroll bar on the page. Up until now, my solution was to have the width of the Station V3 image set at 630 pixels. This was not an optimal solution though, as the text in the comic was at times difficult to read, and it meant that anyone using an 800x600 screen was still stuck with a horizontal scrollbar.

So I kept plugging away and plugging away at it. Sometimes I would think I had found the solution, only to try it in another browser and see that nope, it didn't work. I also noticed in my searches on how to do this that quite a few other people had been looking for the same thing. So, now that I finally have something that works in several browsers, I figured I'd share the technique with the world. Hopefully anyone else who wants to do Elastic Design on their blog will find this right away and won't have to go through hours and hours of fruitless searching.

The basic template for this blog is the Minima design by Douglas Bowman of Stopdesign. The formatting in the text areas below has been altered - I have removed all the line breaks that Douglas Bowman had in there. In the template itself the line breaks are necessary for readability, but if I copied the code straight into the text areas there would be all sorts of < br> tags that shouldn't be there. One can cut and paste the following code straight into one's blog template, but line breaks should be reinserted as necessary to increase readability.

The first modification was in the Style section of the template (between the <style> and </style> tags):


The width:* commands in this style section allow the elastic sizing of the text in blog posts; these basically set the width to "whatever is available". The #content part is for the entire blog, and the #main part is for the section with all the blog posts and title and so on. The top:35px for the #main and #sidebar sections allow room for the Blogger Navbar at the top of the page.

Next, I had to make up a new division tag, also in the Style section:


I'll explain this in a minute.

Normally on the Minima blog template, there is a "header" section immediately after the body tag:


I wanted to replace this header section, which normally just had plain text, with my fancy new image. To do that I had to get rid of that entire <div id="header"> ... </div> section. Then, immediately following the main and main2 <div> tags, in the main content part of the blog, I inserted the following:


The first thing to note here is the <div id="variablewidthimage"> tag. This is the tag that I defined above in the Style section, which set the width at 75%. This sets the width of the division at 75% of the browser width. I figured that the minimum size browser screen would be 750 pixels wide, for an 800x600 display with a vertical scrollbar on the right. I knew that my sidebar plus padding would take up 175 pixels, which is a little over 23% of the width of a 750 pixel wide display, so that 75% wide division is wide enough to take up the rest of the width of the display without running over the sidebar, and also gives just a little bit of padding on the outside. If my sidebar took up 250 pixels including padding, and I was again assuming a minimum browser width of 750 pixels, then in the Style section I would have set the width of the variablewidthimage division tag to some percentage slightly smaller than 66%, probably somewhere from 60% to 65%.

The next thing to note is that I used the <center> tag both inside and outside the <div> tags. The center tag on the outside centers the division within the main section of the blog, and the center tag on the inside of the division centers the image within the division.

I did the same thing with Station V3:


Both my title image and the Station V3 image have a width="100%" command inside the <img> tags. This tells the browser to display the image at 100% of the division width, not 100% of the original image size.

The original image width for my title graphic is 625 pixels, and the original image width for Station V3 is 750 pixels. Both of these images are displayed at the same size on the blog though, whatever corresponds to 75% of the width of the browser window. It doesn't matter if the available area is smaller or bigger than either original image; they are both either shrunken or stretched to fit. Figuring this out was a huge headache - and hence this lengthy blog post so nobody else has to go through that same headache.

Stretching the Sudoku puzzle section was quite a bit easier. The Sudoku puzzle is in a table, and rather than having a set width to the table like I used to (i.e. <table width="650">) I simply left the width part out (ie <table>). The table expanded to fit the width of the main part of the blog, as defined in the Style section above.

That's it, that's all there is to it. I hope you like it.

If this is your first time here - maybe you came here via a Google search looking for how to do elastic images or elastic design - then you might also be interested in the method used to do the scrolling blogrolls in the sidebar. You can find the necessary code for that here.

Update: whoops, for some bizarre reason, comments and backlinks were turned off for this post. Fixed now.

Update 2: OK, now this is bizarre. I was looking through this code months later and I noticed something strange. Immediately prior to the #variablewidthimage declaration in my style section, there was an extra closing brace } all by itself, with no corresponding opening brace; that is an html error. When I took that brace out, the elastic images no longer worked in all browsers. You read that right: I had to introduce an html error to get this to work in all browsers. That freaked me out. It shouldn't work at all! But it does. I did this a little differently - without html errors - in my Space Feeds aggregator; that method uses tables though. If you want to see how I do it there, just click on over and View Source.

Tuesday, March 13, 2007

Surf's Up on Titan

Titan continues to yield suprises. Saturn's largest moon has a crushing, thick mostly nitrogen and hydrocarbon atmosphere, which until the Cassini-Huygens mission hid the surface of the moon from observation.

The Cassini team has announced the discovery of at least two large seas near the North pole of Saturn's moon Titan. The swimming there wouldn't likely be very good however, as it appears that the seas are super-cold and contain either liquid ethane or methane.

The larger of the two seas is bigger than any lake on the Earth, and nearly as large as the Caspian Sea.

Monday, March 12, 2007

The Great Global Warming Swindle

I saw this earlier today, and had to share it with the world. I'll be writing a lot more about this subject over the next few days.

Update:
The version of this video that I had posted before is no longer on Google Video. This is another version of the same video; hopefully it will stay posted for a few more days. If there are future problems with this new version of the video, then you can likely find it here.

300

Two months ago, I was watching a video of a 1962 movie called The 300 Spartans. It was kinda boring, actually, and I didn't manage to sit through the whole thing. Well, apparently a graphic novel was recently made, based on that movie, and then a movie based on that graphic novel was just released on Friday. Here's the trailer:


Oh, hell yes. I've gotta see this movie.

Christians as Scientists

Rob Knop of Galactic Interactions, defender of the faith:
It's very irritating to come to my blog and see the advertisement at top for a book proclaiming loudly " GOD: The Failed Hypothesis. How science shows that God does not exist." I haven't clicked on the link, and won't, because its very title indicates to me that it's hogwash.

This bugs me on two levels. First, it sets off my bullshit-o-meter in a big way. God is not a scientific concept, and as such science cannot disprove the existence of God. Science has obviated the need for God or gods for many people, and science assuredly has disproven a lot of things people claim in the name of god (e.g. all of the absurdity claimed by creationists), but that's different from disproving God itself.
This is something that has bugged me for a while, too - the idea that those with religious beliefs are somehow anti-science, or superstitious nutbars, or illiterate. I have seen it on far too many occasions, and it distresses me to see it on sites like scienceblogs.com or badastronomy.com.

Science and religion are two completely different realms. Attempting to mix the two yeilds nothing productive, whether it is the aforementioned book that claims to disprove the existence of God, or fundamentalists that fight against the teaching of evolution in schools. Both are completely wrong.

To those who purport to be scientists, who spend their time attempting to disprove God: show me your data. Show me your experiments that disprove God. You can't, because what you're doing isn't science. One can no more use science to disprove God than one can use science to prove the existence of God. If you could, then whatever you are studying is by definition (ie. surpassing all human understanding) not God.

To those who seek to use religion as a cudgel to force schools to stop teaching evolution: who are you to tell God what tools he may or may not use? Quit wasting your time arguing about what you're going to allow God to do, and instead study what He actually did (which was to set the conditions of the universe up right from very start so that stars, planets, life, and intelligence would eventually form - which when you think about it, is even more remarkable than a simple six-day creative burst).

I am a Christian, and both of the groups I mention above piss me off.

I want to end this blog post with a couple of quotes:
"Gravity explains the motions of the planets, but it cannot explain who set the planets in motion. God governs all things and knows all that is or can be done."

"I have a fundamental belief in the Bible as the Word of God, written by those who were inspired. I study the Bible daily."
So, who was the irrational, superstitious, illiterate, fundamentalist whackjob that wrote these words? None other than Isaac Newton, arguably the greatest scientific genius the world has ever known. Consider that the next time you dismiss a Christian as a superstitious fool.

Thursday, March 08, 2007

watch a launch

There is an Atlas V launch tonight from Cape Canaveral. The launch window is from 9:37 to 11:42 pm EST. You can watch a live webcast of the launch, starting at 9:17pm EST, here.

Wednesday, March 07, 2007

Quantifying Light Pollution

Light pollution is the bane of astronomers everywhere. Light from cities tends to wash out our view of the night sky, making observations difficult. Generally speaking, the more artificial light in the area, the less starlight one is able to see. Now, an effort is underway to quantify just how much light pollution is in one's general vicinity, and anyone with an internet connection and a sky above can participate. Via Dave Pearson and Astronomy Buff comes word of the Globe at Night project. Here's the basic idea:

First, look up your latitude and longitude (you can do that here or here).

Next, sometime between 7pm and 10pm local time from March 8th to March 21st, go outside and find Orion. This constellation was chosen because it is visible to pretty much everybody and is highly recognizable.

Then, match your nighttime sky to one of Globe at Night's magnitude charts. Stars with higher magnitude numbers are fainter, so the less light pollution there is in your area the higher the magnitude of star you can see. Report your results to Globe at Night.

If one is so inclined, you can compare your results to those of people around the world.

Last year, more than 18000 people from 96 countries participated in the study; of course, the more people who participate, the better the results will be. Tell your friends!

Thursday, March 01, 2007

Assembling the Space Station

Assembling the Space Station

Here's a cool video showing the past and future assembly of the International Space Station. So far, about the first minute of this video has been accomplished.